#!/usr/bin/env bash

sedHql(){
   for t in $(cat midtables.txt)
   do
      sed -i "s/${t} /realtime.${t} /ig" $1
   done

}

timefunc(){
sed -i 's/date -d " 12 hours ago "  "+%Y-%m-%d %H"/date -d "$d  0 days ago "  "+%Y-%m-%d"/g' $1
}
for f in $(ls)
do
  if [[ ${f} == *select.sh ]]
   then
      echo ${f}
#      sedHql ${f}
      timefunc ${f}
   else
   echo no
  fi
done


# 'pos.hql' ]]
# || [[ ${f} == 'posvip.hql' ]] ||
# [[ ${f} == 'beijingvip.hql' ]] ||
# [[ ${f} == 'chengdevip.hql' ]] ||
# [[ ${f} == 'coupon.hql' ]] ||
# [[ ${f} == 'b.hql' ]] ||
# [[ ${f} == 'RFM.hql' ]] ||
# [[ ${f} == 'tag.hql' ]] ||
# [[ ${f} == 'tag_cd.hql' ]] ||
# [[ ${f} == 'hoseefficiency.hql' ]]


